/*
 * @Author: 张家亮 1690608011@qq.com
 * @Date: 2022-08-18 23:11:11
 * @LastEditors: 张家亮 1690608011@qq.com
 * @LastEditTime: 2022-08-20 10:57:48
 * @FilePath: \vue-store-server\app\middleware\error.js
 * @Description: 全局错误处理中间件
 * 
 * Copyright (c) 2022 by 张家亮 1690608011@qq.com, All Rights Reserved. 
 */
module.exports = async (ctx, next) => {
  try {
    await next();
  } catch (error) {
    console.log(error);
    ctx.body = {
      code: '500',
      msg: '服务器未知错误'
    }
  }
}